﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Pause : MonoBehaviour
{
    private Animator anima;
    public GameObject pause_button;

    private void Awake()
    {
        anima = GetComponent<Animator>();
    }

    public void OpenPausePanel()
    {
        //禁止操作小鸟
        GameManager._instance.birds[0].can_move = false;
        //隐藏按钮
        pause_button.SetActive(false);
        //打开暂停面板
        anima.SetBool("is_pause",true);
    }

    public void OpenPauseEnd()
    {
        Time.timeScale = 0; //停止时间
    }

    //注意停止时间后动画无法播放，要将恢复时间代码放在按钮事件上而不是动画上
    public void ClosePausePanel()
    {
        Time.timeScale = 1; //恢复时间
        //关闭暂停面板
        anima.SetBool("is_pause",false);
    }

    public void ClosePauseEnd()
    {
        //恢复按钮
        pause_button.SetActive(true);
        //恢复操作小鸟
        GameManager._instance.birds[0].can_move = true;
    }
}
